home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol A-4 / (Vol A-4) Vol. A4.iso / Games / maquiagem-lana.swf / scripts / __Packages / mx / styles / CSSSetStyle.as next >
Text File  |  2007-11-28  |  10KB  |  293 lines

  1. class mx.styles.CSSSetStyle
  2. {
  3.    static var classConstructed = mx.styles.CSSSetStyle.classConstruct();
  4.    static var CSSStyleDeclarationDependency = mx.styles.CSSStyleDeclaration;
  5.    function CSSSetStyle()
  6.    {
  7.    }
  8.    function _setStyle(styleProp, newValue)
  9.    {
  10.       this[styleProp] = newValue;
  11.       if(mx.styles.StyleManager.TextStyleMap[styleProp] != undefined)
  12.       {
  13.          if(styleProp == "color")
  14.          {
  15.             if(isNaN(newValue))
  16.             {
  17.                newValue = mx.styles.StyleManager.getColorName(newValue);
  18.                this[styleProp] = newValue;
  19.                if(newValue == undefined)
  20.                {
  21.                   return undefined;
  22.                }
  23.             }
  24.          }
  25.          _level0.changeTextStyleInChildren(styleProp);
  26.          return undefined;
  27.       }
  28.       if(mx.styles.StyleManager.isColorStyle(styleProp))
  29.       {
  30.          if(isNaN(newValue))
  31.          {
  32.             newValue = mx.styles.StyleManager.getColorName(newValue);
  33.             this[styleProp] = newValue;
  34.             if(newValue == undefined)
  35.             {
  36.                return undefined;
  37.             }
  38.          }
  39.          if(styleProp == "themeColor")
  40.          {
  41.             var _loc7_ = mx.styles.StyleManager.colorNames.haloBlue;
  42.             var _loc6_ = mx.styles.StyleManager.colorNames.haloGreen;
  43.             var _loc8_ = mx.styles.StyleManager.colorNames.haloOrange;
  44.             var _loc4_ = {};
  45.             _loc4_[_loc7_] = 12188666;
  46.             _loc4_[_loc6_] = 13500353;
  47.             _loc4_[_loc8_] = 16766319;
  48.             var _loc5_ = {};
  49.             _loc5_[_loc7_] = 13958653;
  50.             _loc5_[_loc6_] = 14942166;
  51.             _loc5_[_loc8_] = 16772787;
  52.             var _loc9_ = _loc4_[newValue];
  53.             var _loc10_ = _loc5_[newValue];
  54.             if(_loc9_ == undefined)
  55.             {
  56.                _loc9_ = newValue;
  57.             }
  58.             if(_loc10_ == undefined)
  59.             {
  60.                _loc10_ = newValue;
  61.             }
  62.             this.setStyle("selectionColor",_loc9_);
  63.             this.setStyle("rollOverColor",_loc10_);
  64.          }
  65.          _level0.changeColorStyleInChildren(this.styleName,styleProp,newValue);
  66.       }
  67.       else
  68.       {
  69.          if(styleProp == "backgroundColor" && isNaN(newValue))
  70.          {
  71.             newValue = mx.styles.StyleManager.getColorName(newValue);
  72.             this[styleProp] = newValue;
  73.             if(newValue == undefined)
  74.             {
  75.                return undefined;
  76.             }
  77.          }
  78.          _level0.notifyStyleChangeInChildren(this.styleName,styleProp,newValue);
  79.       }
  80.    }
  81.    function changeTextStyleInChildren(styleProp)
  82.    {
  83.       var _loc4_ = getTimer();
  84.       var _loc5_ = undefined;
  85.       for(_loc5_ in this)
  86.       {
  87.          var _loc2_ = this[_loc5_];
  88.          if(_loc2_._parent == this)
  89.          {
  90.             if(_loc2_.searchKey != _loc4_)
  91.             {
  92.                if(_loc2_.stylecache != undefined)
  93.                {
  94.                   delete _loc2_.stylecache.tf;
  95.                   delete _loc2_.stylecache[styleProp];
  96.                }
  97.                _loc2_.invalidateStyle(styleProp);
  98.                _loc2_.changeTextStyleInChildren(styleProp);
  99.                _loc2_.searchKey = _loc4_;
  100.             }
  101.          }
  102.       }
  103.    }
  104.    function changeColorStyleInChildren(sheetName, colorStyle, newValue)
  105.    {
  106.       var _loc6_ = getTimer();
  107.       var _loc7_ = undefined;
  108.       for(_loc7_ in this)
  109.       {
  110.          var _loc2_ = this[_loc7_];
  111.          if(_loc2_._parent == this)
  112.          {
  113.             if(_loc2_.searchKey != _loc6_)
  114.             {
  115.                if(_loc2_.getStyleName() == sheetName || sheetName == undefined || sheetName == "_global")
  116.                {
  117.                   if(_loc2_.stylecache != undefined)
  118.                   {
  119.                      delete _loc2_.stylecache[colorStyle];
  120.                   }
  121.                   if(typeof _loc2_._color == "string")
  122.                   {
  123.                      if(_loc2_._color == colorStyle)
  124.                      {
  125.                         var _loc4_ = _loc2_.getStyle(colorStyle);
  126.                         if(colorStyle == "color")
  127.                         {
  128.                            if(this.stylecache.tf.color != undefined)
  129.                            {
  130.                               this.stylecache.tf.color = _loc4_;
  131.                            }
  132.                         }
  133.                         _loc2_.setColor(_loc4_);
  134.                      }
  135.                   }
  136.                   else if(_loc2_._color[colorStyle] != undefined)
  137.                   {
  138.                      if(typeof _loc2_ != "movieclip")
  139.                      {
  140.                         _loc2_._parent.invalidateStyle();
  141.                      }
  142.                      else
  143.                      {
  144.                         _loc2_.invalidateStyle(colorStyle);
  145.                      }
  146.                   }
  147.                }
  148.                _loc2_.changeColorStyleInChildren(sheetName,colorStyle,newValue);
  149.                _loc2_.searchKey = _loc6_;
  150.             }
  151.          }
  152.       }
  153.    }
  154.    function notifyStyleChangeInChildren(sheetName, styleProp, newValue)
  155.    {
  156.       var _loc5_ = getTimer();
  157.       var _loc6_ = undefined;
  158.       for(_loc6_ in this)
  159.       {
  160.          var _loc2_ = this[_loc6_];
  161.          if(_loc2_._parent == this)
  162.          {
  163.             if(_loc2_.searchKey != _loc5_)
  164.             {
  165.                if(_loc2_.styleName == sheetName || _loc2_.styleName != undefined && typeof _loc2_.styleName == "movieclip" || sheetName == undefined)
  166.                {
  167.                   if(_loc2_.stylecache != undefined)
  168.                   {
  169.                      delete _loc2_.stylecache[styleProp];
  170.                      delete _loc2_.stylecache.tf;
  171.                   }
  172.                   delete _loc2_.enabledColor;
  173.                   _loc2_.invalidateStyle(styleProp);
  174.                }
  175.                _loc2_.notifyStyleChangeInChildren(sheetName,styleProp,newValue);
  176.                _loc2_.searchKey = _loc5_;
  177.             }
  178.          }
  179.       }
  180.    }
  181.    function setStyle(styleProp, newValue)
  182.    {
  183.       if(this.stylecache != undefined)
  184.       {
  185.          delete this.stylecache[styleProp];
  186.          delete this.stylecache.tf;
  187.       }
  188.       this[styleProp] = newValue;
  189.       if(mx.styles.StyleManager.isColorStyle(styleProp))
  190.       {
  191.          if(isNaN(newValue))
  192.          {
  193.             newValue = mx.styles.StyleManager.getColorName(newValue);
  194.             this[styleProp] = newValue;
  195.             if(newValue == undefined)
  196.             {
  197.                return undefined;
  198.             }
  199.          }
  200.          if(styleProp == "themeColor")
  201.          {
  202.             var _loc10_ = mx.styles.StyleManager.colorNames.haloBlue;
  203.             var _loc9_ = mx.styles.StyleManager.colorNames.haloGreen;
  204.             var _loc11_ = mx.styles.StyleManager.colorNames.haloOrange;
  205.             var _loc6_ = {};
  206.             _loc6_[_loc10_] = 12188666;
  207.             _loc6_[_loc9_] = 13500353;
  208.             _loc6_[_loc11_] = 16766319;
  209.             var _loc7_ = {};
  210.             _loc7_[_loc10_] = 13958653;
  211.             _loc7_[_loc9_] = 14942166;
  212.             _loc7_[_loc11_] = 16772787;
  213.             var _loc12_ = _loc6_[newValue];
  214.             var _loc13_ = _loc7_[newValue];
  215.             if(_loc12_ == undefined)
  216.             {
  217.                _loc12_ = newValue;
  218.             }
  219.             if(_loc13_ == undefined)
  220.             {
  221.                _loc13_ = newValue;
  222.             }
  223.             this.setStyle("selectionColor",_loc12_);
  224.             this.setStyle("rollOverColor",_loc13_);
  225.          }
  226.          if(typeof this._color == "string")
  227.          {
  228.             if(this._color == styleProp)
  229.             {
  230.                if(styleProp == "color")
  231.                {
  232.                   if(this.stylecache.tf.color != undefined)
  233.                   {
  234.                      this.stylecache.tf.color = newValue;
  235.                   }
  236.                }
  237.                this.setColor(newValue);
  238.             }
  239.          }
  240.          else if(this._color[styleProp] != undefined)
  241.          {
  242.             this.invalidateStyle(styleProp);
  243.          }
  244.          this.changeColorStyleInChildren(undefined,styleProp,newValue);
  245.       }
  246.       else
  247.       {
  248.          if(styleProp == "backgroundColor" && isNaN(newValue))
  249.          {
  250.             newValue = mx.styles.StyleManager.getColorName(newValue);
  251.             this[styleProp] = newValue;
  252.             if(newValue == undefined)
  253.             {
  254.                return undefined;
  255.             }
  256.          }
  257.          this.invalidateStyle(styleProp);
  258.       }
  259.       if(mx.styles.StyleManager.isInheritingStyle(styleProp) || styleProp == "styleName")
  260.       {
  261.          var _loc8_ = undefined;
  262.          var _loc5_ = newValue;
  263.          if(styleProp == "styleName")
  264.          {
  265.             _loc8_ = typeof newValue != "string" ? _loc5_ : _global.styles[newValue];
  266.             _loc5_ = _loc8_.themeColor;
  267.             if(_loc5_ != undefined)
  268.             {
  269.                _loc8_.rollOverColor = _loc8_.selectionColor = _loc5_;
  270.             }
  271.          }
  272.          this.notifyStyleChangeInChildren(undefined,styleProp,newValue);
  273.       }
  274.    }
  275.    static function enableRunTimeCSS()
  276.    {
  277.    }
  278.    static function classConstruct()
  279.    {
  280.       var _loc2_ = MovieClip.prototype;
  281.       var _loc1_ = mx.styles.CSSSetStyle.prototype;
  282.       mx.styles.CSSStyleDeclaration.prototype.setStyle = _loc1_._setStyle;
  283.       _loc2_.changeTextStyleInChildren = _loc1_.changeTextStyleInChildren;
  284.       _loc2_.changeColorStyleInChildren = _loc1_.changeColorStyleInChildren;
  285.       _loc2_.notifyStyleChangeInChildren = _loc1_.notifyStyleChangeInChildren;
  286.       _loc2_.setStyle = _loc1_.setStyle;
  287.       var _loc3_ = TextField.prototype;
  288.       _loc3_.setStyle = _loc2_.setStyle;
  289.       _loc3_.changeTextStyleInChildren = _loc1_.changeTextStyleInChildren;
  290.       return true;
  291.    }
  292. }
  293.